package com.tang.calculator.calculateImpl;

import com.tang.calculator.AbstractProcessor;
import com.tang.calculator.CalculateProcessor;
import com.tang.calculator.Context;
import com.tang.calculator.DataSource;
import com.tang.calculator.annotation.Operate;
import org.springframework.stereotype.Component;

import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.List;

/**
 * @ClassName: ExpDisbmProcessor
 * @Author: freedu
 * @Date: 2021/3/22 16:23
 * @Description: TODO
 * @Version: 1.0
 */
@Component("exp_Disbm")
public class ExpDisbmProcessor extends AbstractProcessor<BigInteger> implements CalculateProcessor {
    /**
     * @param context
     */
    @Operate("add")
    public void add(Context context) {
        System.out.println("调用了exp_Disbm的add");
        List<DataSource> dataSourceByType = context.getDataSourceByType(Object.class);
        dataSourceByType.forEach(d -> d.setSubmitted(true));
//        service.saveBatch(dataSourceByType);
    }

    @Operate("delete")
    public void delete(Context context){
        System.out.println("调用了exp_Disbm的delete");
        List<DataSource> dataSourceByType = context.getDataSourceByType(Object.class);
        dataSourceByType.forEach(d -> d.setSubmitted(true));
//        service.deleteBatch
    }

    @Operate("edit")
    public void edit(Context context){
        System.out.println("调用了exp_Disbm的edit");
    }
}
